<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_盒子模型练习</title>
  <style>
    .card {
      width: 300px;
      padding: 10px;
      background-color: #e8e8e8;
      margin-bottom: 30px;
    }
    .card>img {
      /* 图片宽度为父级卡片宽度的100% 随着父级的改变而改变*/
      width: 100%;
    }
    .card>p {
      border: 5px solid red;
      margin: 10px 20px 30px 40px;
    }
  </style>
</head>
<body>
  <div class="card">
    <img src="img/1.png">
    <p>我是文字</p>
  </div>
  <div class="card">
    <img src="img/1.png">
    <p>我是文字</p>
  </div>
</body>
</html>